#!/bin/bash


if [ 'rrqm' == "$2" ];then
    pos="rrqm"
elif [ 'wrqm' = "$2" ];then
    pos="wrqm"
elif [ 'rps' == "$2" ];then
    pos="rps"
elif [ 'wps' == "$2" ];then
    pos="wps"
elif [ 'rKBps' == "$2" ];then
    pos="rKBps"
elif [ 'wKBps' == "$2" ];then
    pos="wKBps"
elif [ 'avgrq-sz' == "$2" ];then
    pos="avgrq-sz"
elif [ 'avgqu-sz' == "$2" ];then
    pos="avgqu-sz"
elif [ 'await' == "$2" ];then
    pos="await"
elif [ 'svctm' == "$2" ];then
    pos="svctm"
elif [ 'util' == "$2" ];then
    pos="util"
else
    pos=0
fi



case $pos in 
    rrqm)
        iostat -dxk 1 1|grep -w "$1" |awk '{print $2}'
        ;;
    wrqm)
        iostat -dxk 1 1|grep -w "$1" |awk '{print $3}'
        ;;
    rps)
        iostat -dxk 1 1|grep -w "$1" |awk '{print $4}'
        ;;
    wps)
        iostat -dxk 1 1|grep -w "$1" |awk '{print $5}'
        ;;
    rKBps)
        iostat -dxk 1 1|grep -w "$1" |awk '{print $6}'
        ;;
    wKBps)
        iostat -dxk 1 1|grep -w "$1" |awk '{print $7}'
        ;;
    avgrq-sz)
        iostat -dxk 1 1|grep -w "$1" |awk '{print $8}'
        ;;
    avgqu-sz)
        iostat -dxk 1 1|grep -w "$1" |awk '{print $9}'
        ;;
    await)
        iostat -dxk 1 1|grep -w "$1"|awk '{print $10}'
        ;;
    svctm)
        iostat -dxk 1 1|grep -w "$1" |awk '{print $13}'
        ;;
    util)
        iostat -dxk 1 1|grep -w "$1" |awk '{print $14}'
        ;;
    *)
        echo -e "\e[033mUsage: sh $0 [rrqm|wrqm|rps|wps|rKBps|wKBps|avgqu-sz|avgrq-sz|await|svctm|util]\e[0m"
esac
